function demoDrawableImages(delay)
% Demonstrate drawing an image from a file, allow visual inspection.

if nargin < 1
    delay = 2;
end

% access the manager that deals with drawing
dotsTheDrawablesManager.reset();
dm = dotsTheDrawablesManager.theObject;

% create an object which can read an image file for OpenGL display
%   the 'Tetons-Sunset.jpg' image is included along with this demo
im = dm.newObject('dotsDrawableImages');
im.fileNames = {'Tetons-Sunset.jpg'};

% add the image object to a group for the manager to draw.
dm.addObjectToGroup(im, 'demo', 1);
dm.activateGroup('demo');

% open an OpenGL drawing window and show the image without stretching
dm.openScreenWindow;
dm.mayDrawNextFrame;
pause(delay);

% redraw the image with some stretching and rotating
im.height = 10;
im.width = 1;
dm.mayDrawNextFrame;
pause(delay);

im.rotation = 45;
dm.mayDrawNextFrame;
pause(delay);

% use native image size to inform stretching
%   update client side properties to reflect server side textures
dm.updateClientObjectProperties(im);
h = 20;
im.height = h;
im.width = h*(im.pixelWidths(1)/im.pixelHeights(1));
im.rotation = 0;
im.x = -5;
im.y = 3;
dm.mayDrawNextFrame;
pause(delay);

% close the OpenGL drawing window
dm.closeScreenWindow;